Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 9, 2025

Summary

Adds RUSHSTACK_CLI_IGNORED_PARAMETER_NAMES environment variable to forward the parameterNamesToIgnore operation setting from rush-project.json to child processes during phased command execution. The environment variable name is exported as a public constant for use by consumers.

Details

Implementation:

  • Created IgnoredParametersPlugin that taps the createEnvironmentForOperation hook
  • Reads parameterNamesToIgnore directly from operation.settings (raw configuration value, not CLI-affected values)
  • Sets RUSHSTACK_CLI_IGNORED_PARAMETER_NAMES with JSON-stringified array when defined (following ts-command-line convention for list-type parameters)
  • Exported the environment variable name as RUSHSTACK_CLI_IGNORED_PARAMETER_NAMES_ENV_VAR constant with literal type annotation for external use
  • Integrated into PhasedScriptAction alongside other standard plugins

Design:

  • Follows pattern established by NodeDiagnosticDirPlugin
  • Naming consistent with existing RUSHSTACK_FILE_ERROR_BASE_FOLDER convention
  • Only sets environment variable when configuration explicitly defines ignored parameters
  • Environment variable name exported as public constant with literal type to avoid hardcoded strings in consuming code
  • Uses JSON.stringify() to encode array values, following the ts-command-line convention for passing list-type parameters via environment variables (handles special characters like commas correctly)

Example:

Given a rush-project.json with:

{
  "operationSettings": [
    {
      "operationName": "build",
      "parameterNamesToIgnore": ["--verbose", "--production"]
    }
  ]
}

Child processes will receive:

RUSHSTACK_CLI_IGNORED_PARAMETER_NAMES='["--verbose","--production"]'

Consumers can reference the environment variable name using:

import { RUSHSTACK_CLI_IGNORED_PARAMETER_NAMES_ENV_VAR } from '@microsoft/rush-lib';

How it was tested

Added unit tests verifying:

  • Environment variable set correctly when parameterNamesToIgnore is specified
  • Environment variable not set when parameterNamesToIgnore is absent
  • Correct values forwarded for different project configurations (JSON-stringified arrays)
  • Tests use the exported constant to avoid hardcoded strings

All tests pass. No regressions in existing test suite.

Impacted documentation

None. This is an internal implementation detail for plugin authors.

Original prompt

In rush-lib, use the createEnvironmentForOperation phased command hook to forward the value of the parameterNamesToIgnore operation setting to child processes as an environment variable. Use similar naming to the RUSHSTACK_BASE_ERROR_FOLDER environment variable.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits December 9, 2025 23:11
…ronment variable

Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com>
Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com>
Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com>
Copilot AI changed the title [WIP] Add environment variable for parameterNamesToIgnore [rush-lib] Forward parameterNamesToIgnore to child processes via environment variable Dec 9, 2025
Copilot AI requested a review from dmichon-msft December 9, 2025 23:26
Copy link
Contributor

@dmichon-msft dmichon-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Address feedback.

Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com>
Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com>
Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com>
@dmichon-msft
Copy link
Contributor

@copilot Run rush change --no-fetch --bulk --bump-type none --message "${description}" to create a change file, then ensure that the file path and content of the created change file reference @microsoft/rush and not any other package.

Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 10, 2025

@copilot Run rush change --no-fetch --bulk --bump-type none --message "${description}" to create a change file, then ensure that the file path and content of the created change file reference `@micr...

Created change file at common/changes/@microsoft/rush/copilot-forward-parameter-names-ignore_2025-12-10-21-30.json with bump-type "none" and the specified message. The file correctly references @microsoft/rush package. See commit 3614780.

@dmichon-msft dmichon-msft marked this pull request as ready for review December 16, 2025 23:54
Copy link
Member

@iclanton iclanton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Address feedback.

…tations

Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com>
@iclanton iclanton enabled auto-merge (squash) December 17, 2025 01:22
@iclanton iclanton moved this from Needs triage to In Progress in Bug Triage Dec 17, 2025
@iclanton iclanton merged commit 923758a into main Dec 17, 2025
12 checks passed
@iclanton iclanton deleted the copilot/forward-parameter-names-ignore branch December 17, 2025 20:01
@github-project-automation github-project-automation bot moved this from In Progress to Closed in Bug Triage Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

3 participants